package com.settlement.system.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.common.base.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
* <p>
* 视频号资金流水
* </p>
*
* @author huangrensen
* @since 2024-06-18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SphFundFlow extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
    * ID
    */
    private String id;


    /**
    * 店铺ID
    */
    private Long storeId;
    @TableField(exist = false)
    private String storeName;


    /**
    * 流水单号
    */
    private String flowNo;


    /**
    * 记账时间
    */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime billTime;
    @TableField(exist = false)
    private LocalDateTime startBillTime;
    @TableField(exist = false)
    private LocalDateTime endBillTime;


    /**
    * 动帐类型
    */
    private String billType;


    /**
    * 收支类型
    */
    private String payType;


    /**
    * 收支金额
    */
    private BigDecimal billAmount;


    /**
    * 账户余额
    */
    private BigDecimal balanceAmount;


    /**
    * 关联订单号
    */
    private String orderNo;


    /**
    * 关联售后单号
    */
    private String returnNo;


    /**
    * 关联提现单号
    */
    private String cashOutNo;


    /**
    * 关联保单号
    */
    private String policyNo;


    /**
    * 详情
    */
    private String remark;

    @TableField(exist = false)
    private String tableName;
    @TableField(exist = false)
    private String billMonth;

    // 截取长度超出范围的字段
    public void cutString() {
        if (this.remark != null && this.remark.length() > 2000) {
            this.remark = this.remark.substring(0, 2000);
        }
    }

}
